package cn.ssj.service.impl;

import cn.ssj.dao.CarouselDao;
import cn.ssj.entity.Carousel;
import cn.ssj.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * Created by Administrator on 2017/9/3 0003.
 */
@Service
public class CarouselServiceImpl extends BaseServiceImpl<Carousel,Integer> implements CarouselService {
    @Autowired
    private CarouselDao dao;

    /**
     * 根据目标和使用标记查询轮播图
     *
     * @param target  目标
     * @param useFlag 使用标记
     * @return
     */
    public List<Carousel> queryByTargetAndUseFlag(String target, String useFlag) {
        return dao.findCarouselByTargetAndUseFlagoOrderBySort(target,useFlag);
    }

    /**
     * 根据实体使用标记进行查询useFlag
     *
     * @param useFlag 使用标记
     * @return
     */
    public List<Carousel> queryByUseFlag(String useFlag) {
        return super.queryByUseFlag(useFlag);
    }

    @Transactional
    public Carousel insert(Carousel entity) {
        return super.insert(entity);
    }
    @Transactional
    public Carousel update(Carousel entity) {
       return super.update(entity);
    }
    @Transactional
    public boolean delete(Integer id) {
        return super.delete(id);
    }
}
